// File:    Telefone.cs
// Author:  Lucas Bittencourt
// Created: quarta-feira, 16 de novembro de 2011 18:32:47
// Purpose: Definition of Class Telefone

using System;
using System.Text;

namespace DA_OOMModel
{
   public class Telefone
   {
       private int telIdTelefone;
       private string telCdDdd;
       private string telNuTelefone;

       private Pessoa pessoa;
      
      /// <summary>
      /// Property for Pessoa
      /// </summary>
      /// <pdGenerated>Default opposite class property</pdGenerated>
      public virtual Pessoa Pessoa
      {
         get
         {
            return pessoa;
         }
         set
         {
               this.pessoa = value;
         }
      }
   
      /// <summary>
      /// Get value of property TelIdTelefone.
      /// </summary>
      public virtual int TelIdTelefone
      {
         get
         {
            return telIdTelefone;
         }
         set
         {
            if (this.telIdTelefone != value)
               this.telIdTelefone = value;
         }
      }
      
      /// <summary>
      /// Get value of property TelCdDdd.
      /// </summary>
      public virtual string TelCdDdd
      {
         get
         {
            return telCdDdd;
         }
         set
         {
            if (this.telCdDdd != value)
               this.telCdDdd = value;
         }
      }
      
      /// <summary>
      /// Get value of property TelNuTelefone.
      /// </summary>
      public virtual string TelNuTelefone
      {
         get
         {
            return telNuTelefone;
         }
         set
         {
            if (this.telNuTelefone != value)
               this.telNuTelefone = value;
         }
      }
   
      /// <summary>
      /// Get and set primary key class
      /// </summary>
      public virtual TelefonePK TelefonePK
      {
         get 
         {
            return new TelefonePK(telIdTelefone);
         }
         set
         {
            if (value != null)
            {
               this.telIdTelefone = value.TelIdTelefone;
            }
         }
      }
   
      /// <summary>
      /// Get hash code
      /// </summary>
      /// <pdGenerated>Get hash code</pdGenerated>
      public override int GetHashCode()
      {
         int _hashCode = 0;
         _hashCode = 29 * TelefonePK.GetHashCode();
         if (this.telCdDdd != null) 
            _hashCode += 29 * telCdDdd.GetHashCode();
      
         if (this.telNuTelefone != null) 
            _hashCode += 29 * telNuTelefone.GetHashCode();
         return _hashCode;
      }
   
      /// <summary>
      /// Test if two objects are equal
      /// </summary>
      /// <param name="object">Object to compare</param>
      /// <pdGenerated>Test if two objects are equal</pdGenerated>
      public override bool Equals(object obj)
      {
         if (obj == null)
            return false;
         Telefone cast = obj as Telefone;
         if (!(obj is Telefone))
            return false;
         if (!this.TelefonePK.Equals(cast.TelefonePK))
            return false;
         if (this.telIdTelefone != cast.TelIdTelefone)
            return false;
         if (String.Equals(this.telCdDdd, cast.TelCdDdd) == false)
            return false;
      
         if (String.Equals(this.telNuTelefone, cast.TelNuTelefone) == false)
            return false;
      
      
         return true;
      }
   
      /// <summary>
      /// Get object in string format
      /// </summary>
      /// <pdGenerated>Get object in string format</pdGenerated>
      public override string ToString()
      {
         StringBuilder ret = new StringBuilder();
         ret.Append( "Telefone: " );
         ret.Append( "TelIdTelefone='" + telIdTelefone.ToString() + "'");
         if (telCdDdd != null)
            ret.Append( "TelCdDdd='" + telCdDdd.ToString() + "'");
         if (telNuTelefone != null)
            ret.Append( "TelNuTelefone='" + telNuTelefone.ToString() + "'");
         return ret.ToString();
      }
   
   }
}